<template>
	<view class="page" :style="themeColor">
		<view
			class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex evaluates_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-stretch justify-between evaluates_fd0_0'>
				<view class='flex flex-wrap align-center evaluates_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
					data-url="1">
					<text class='fu-iconfont2  evaluates_fd0_0_c0_c0'>&#xe794;</text>
				</view>
				<view class='flex flex-wrap align-center'>
					<text class='evaluates_fd0_0_c1_c0'>全部评价</text>
				</view>
				<view class='flex align-center justify-end evaluates_fd0_0_c2'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>

		<!---全部评论flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout evaluates_flex_1">
			<view class='flex flex-direction flex-wrap align-stretch evaluates_fd1_0'>
				<benben-select-diy ref="showSelectPopup1667036742877" class-name='flex flex-wrap align-center flex'
					:items.sync="evaluate" v-model="evaluateID" :label.sync="evaluateLable" default-type="type"
					default-label="name" :allow-cancel='false' type="radio" :disabled='false' @change="selectTab">
					<template v-for='(item,key0) in evaluate'>
						<view v-if="item.isSelected" class='flex align-center justify-center flex evaluates_fd1_0_c0_c0'
							:key="key0" @tap="$refs.showSelectPopup1667036742877.tapHandle(key0)">
							<text class='evaluates_fd1_0_c0_c0_c0'>{{item.name}}</text>
							<text class='evaluates_fd1_0_c0_c0_c1' v-if="item.nums > 0">{{item.nums}}</text>
						</view>
						<view v-else class='flex align-center justify-center flex evaluates_fd1_0_c0_c1' :key="key0"
							@tap="$refs.showSelectPopup1667036742877.tapHandle(key0)">
							<text class='evaluates_fd1_0_c0_c1_c0'>{{item.name}}</text>
							<text class='evaluates_fd1_0_c0_c1_c1' v-if="item.nums > 0">{{item.nums}}</text>
						</view>
					</template></benben-select-diy>
			</view>
		</view>
		<!---全部评论flex布局结束-->
		<!---flex布局flex布局开始-->
		<view class="flex benben-flex-layout flex-wrap align-center evaluates_flex_2">
		</view>
		<view class="loading_css" v-if="!isShow">
			<u-loading size="36" color="#4177DD"></u-loading>
			<view class="loading_text">加载中</view>
		</view>

		<block v-else>
			
			<!---flex布局flex布局结束-->
			<block v-for="(item, index) in list">
				<evaluate :item="item"></evaluate>
			</block>
			<u-loadmore v-if="last_page > 1" style="padding: 24rpx 0;width: 100%;" :status="status" :icon-type="iconType"
				:load-text="loadText" />
			<view class="noData" v-if="list.length == 0">
				<image src="/static/empty/no.png"></image>
				<view>暂无评价~</view>
			</view>
		</block>

		<!---评价列表flex布局开始-->
		<!-- <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout">
			<view class='flex flex-direction flex-wrap align-stretch evaluates_fd3_0' @tap.stop="handleJumpDiy"
				data-type="navigateTo" :data-url="`/?id=1`">
				<view class='flex flex-wrap align-start flex-sub evaluates_fd3_0_c0'>
					<image class='evaluates_fd3_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"125.png"'></image>
					<view class='flex flex-direction flex-wrap align-stretch flex-sub'>
						<view class='flex flex-wrap align-center justify-between evaluates_fd3_0_c0_c1_c0'>
							<text class='evaluates_fd3_0_c0_c1_c0_c0'>蔡***</text>
							<text class='evaluates_fd3_0_c0_c1_c0_c1'>2020-05-20</text>
						</view>
						<view class='flex flex-wrap align-center'>
							<template v-for="starNum in 5">
								<image @click="fd3_0_c0_c1_c1 = starNum" v-if="fd3_0_c0_c1_c1 >= starNum" :key="starNum"
									class='evaluates_star1fd3_0_c0_c1_c1' mode="aspectFit" :src='STATIC_URL+"51.png"'>
								</image>
								<image @click="fd3_0_c0_c1_c1 = starNum" v-else :key="starNum"
									class='evaluates_star1fd3_0_c0_c1_c1' mode="aspectFit" :src='STATIC_URL+"126.png"'>
								</image>
							</template>
						</view>
					</view>
				</view>
				<text class='evaluates_fd3_0_c1'>支持国货，国际大牌，质量细节很到位，东西包裹的非常好，没有损坏的地方！</text>
				<view class='flex flex-wrap align-center evaluates_fd3_0_c2'>
					<view class='flex flex-wrap align-center evaluates_fd3_0_c2_c0'>
						<image class='evaluates_fd3_0_c2_c0_c0' mode="aspectFit" :src='STATIC_URL+"127.png"'></image>
					</view>
				</view>
				<view class='flex flex-wrap align-center evaluates_fd3_0_c3'>
					<text class='evaluates_fd3_0_c3_c0'>黄色，XL</text>
				</view>
			</view>
		</view> -->
		<!---评价列表flex布局结束-->

	</view>
</template>
<script>
	import evaluate from '@/components/evaluate/evaluate.vue'
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {
			evaluate
		},


		data() {
			return {
				"fd3_0_c0_c1_c1": "5",
				"evaluateID": "",
				"evaluateLable": "",
				"evaluate": [{
					"name": "全部",
					"value": "1",
					"image": ""
				}, {
					"name": "好评",
					"value": "2",
					"image": ""
				}, {
					"name": "有图",
					"value": "3",
					"image": ""
				}, {
					"name": "差评",
					"value": "4",
					"image": ""
				}, {
					"name": "中评",
					"value": "5",
					"image": ""
				}, {
					"name": "点赞",
					"value": "6",
					"image": ""
				}],
				"id": "",
				"list": [],
				"page": 1,
				"is_pull": true,
				"last_page": 1,
				"status": 'loadmore',
				"iconType": 'flower',
				"loadText": {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '我也是有底线的'
				},
				"isShow": false
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			let {
				id
			} = options
			if (id !== undefined) this.id = id
			this.getCommentTabs();
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		// 下拉刷新
		onPullDownRefresh() {
			this.page = 1;
			this.is_pull = true;
			this.isShow = false;
			this.getListFunc();
		},
		// 上拉加载
		onReachBottom() {
			if (this.page >= this.last_page) return;
			this.status = 'loading';
			this.page++;
			setTimeout(() => {

				if (this.page >= this.last_page) this.status = 'nomore';
				else this.status = 'loading';
				this.is_pull = false;
				this.getListFunc();
			}, 500)
		},
		onPageScroll(e) {

		},
		methods: {
			// 获取选项卡  post643e37acdce58
			getCommentTabs() {
				this.$api.post(global.apiUrls.post643e37acdce58, {
					goods_id: this.id
				}).then(res => {
					// console.log(res);
					if (res.data.code == 1) {
						this.evaluate = res.data.data;
						if (this.evaluate.length > 0) {
							this.evaluateID = this.evaluate[0].type;
							this.getListFunc()
						} else {
							this.isShow = true;
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			selectTab() {
				this.page = 1;
				this.is_pull = true;
				this.isShow = false;
				this.getListFunc();
			},

			//获取评价列表   post643e37c0440e6
			getListFunc() {
				this.$api.post(global.apiUrls.post643e37c0440e6, {
					page: this.page,
					goods_id: this.id,
					type: this.evaluateID
				}).then(res => {
					uni.stopPullDownRefresh();
					this.isShow = true;
					if (res.data.code == 1) {
						this.last_page = res.data.data.last_page;
						if (this.is_pull) {
							this.list = res.data.data.data;
						} else {
							this.list = this.list.concat(res.data.data.data);
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #fff;
		background-size: 100% auto !important;
	}

	.evaluates_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.evaluates_fd0_0_c2 {
		padding: 0rpx 0rpx 0rpx 0rpx;
		width: 150rpx;
	}

	.evaluates_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
		line-height: 50rpx;
	}

	.evaluates_fd0_0_c0_c0 {
		font-size: 32rpx;
		color: #333;
	}

	.evaluates_fd0_0_c0 {
		width: 150rpx;
	}

	.evaluates_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.evaluates_flex_1 {
		padding: 24rpx 0rpx 0rpx 0rpx;
	}

	.evaluates_fd1_0_c0_c1_c1 {
		font-size: 28rpx;
		font-weight: 400;
		color: #999999;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		text-align: center;
		line-height: 40rpx;
	}

	.evaluates_fd1_0_c0_c1_c0 {
		font-size: 28rpx;
		font-weight: 400;
		color: #999999;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		text-align: center;
		line-height: 40rpx;
	}

	.evaluates_fd1_0_c0_c1 {
		background: rgba(248, 248, 248, 1);
		margin: 12rpx 8rpx 12rpx 8rpx;
		height: 56rpx;
		border-radius: 28rpx 28rpx 28rpx 28rpx;
		padding: 0rpx 25rpx 0rpx 25rpx;
	}

	.evaluates_fd1_0_c0_c0_c1 {
		font-size: 28rpx;
		font-weight: 400;
		color: var(--benbenFontColor4);
		line-height: 40rpx;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		text-align: center;
	}

	.evaluates_fd1_0_c0_c0_c0 {
		font-size: 28rpx;
		font-weight: 400;
		color: var(--benbenFontColor4);
		line-height: 40rpx;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		text-align: center;
	}

	.evaluates_fd1_0_c0_c0 {
		border: 1px solid rgba(48, 131, 255, 1);
		background: rgba(48, 131, 255, 0.07);
		margin: 12rpx 8rpx 12rpx 8rpx;
		height: 56rpx;
		border-radius: 28rpx 28rpx 28rpx 28rpx;
		padding: 0rpx 25rpx 0rpx 25rpx;
	}

	.evaluates_fd1_0 {
		padding: 0rpx 16rpx 16rpx 16rpx;
	}

	.evaluates_flex_2 {
		background: rgba(248, 248, 248, 1);
		height: 20rpx;
		background-size: 100% auto !important;
	}

	.evaluates_fd3_0_c3_c0 {
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
		line-height: 33rpx;
	}

	.evaluates_fd3_0_c3 {
		border-bottom: 1px solid #eee;
		margin: 8rpx 32rpx 0rpx 32rpx;
		padding: 0rpx 0rpx 32rpx 0rpx;
	}

	.evaluates_fd3_0_c2_c0_c0 {
		width: 226rpx;
		height: 226rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
	}

	.evaluates_fd3_0_c2_c0 {
		margin: 0rpx 4rpx 24rpx 0rpx;
	}

	.evaluates_fd3_0_c2 {
		margin: 0rpx 0rpx 0rpx 32rpx;
	}

	.evaluates_fd3_0_c1 {
		margin: 0rpx 32rpx 16rpx 32rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
		-webkit-line-clamp: 2;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
	}

	.evaluates_star1fd3_0_c0_c1_c1 {
		height: 18rpx;
		margin: 0rpx 5rpx 0rpx 5rpx;
		width: 18rpx;
	}

	.evaluates_star1fd3_0_c0_c1_c1 {
		width: 18rpx;
		height: 18rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 5rpx 0rpx 5rpx;
	}

	.evaluates_fd3_0_c0_c1_c0_c1 {
		font-size: 24rpx;
		font-weight: 400;
		color: rgba(153, 153, 153, 1);
	}

	.evaluates_fd3_0_c0_c1_c0_c0 {
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
	}

	.evaluates_fd3_0_c0_c1_c0 {
		margin: 0rpx 0rpx 8rpx 0rpx;
	}

	.evaluates_fd3_0_c0_c0 {
		width: 56rpx;
		height: 56rpx;
		border-radius: 28rpx 28rpx 28rpx 28rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.evaluates_fd3_0_c0 {
		margin: 0rpx 32rpx 24rpx 32rpx;
	}

	.evaluates_fd3_0 {
		padding: 32rpx 0rpx 0rpx 0rpx;
	}
</style>